<?php


namespace app\master\controller;
class Admin extends Base
{
    public function editPassword()
    {
        if (!request()->isPost())
            return $this->fetch('edit_password');
        $password = input('password');
        $com_password = input('compassword');
        if ($password != $com_password) {
            $this->ajaxReturn(603, '两次密码不一致');
        }
        model('admin')->save(['password' => md5($password)], ['admin_id' => session('admin_id')]);
        $this->ajaxReturn(200, '修改成功', url('user/logout'));
    }
}